<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script  runat="server">
Dim liCount As Integer=0
Sub Page_Load(sender As Object, e As EventArgs)	
Try
	Dim strConn As String
	strConn= _
	ConfigurationSettings.appSettings("cons")
	Dim myConn As OleDbConnection  = _
	New OleDbConnection(strConn)
	myConn.Open	
	Dim strSQL as String
	strSQL="Select Count(*) from tblSubCategories "			
	Dim myCom As OleDbCommand = _
	New OleDbCommand(strSQL,myConn)
	liCount =myCom.ExecuteScalar()
	myConn.Close
Catch objError As Exception
	outError.innerHTML = "<b>* Error</b>: " & _
	objError.Message & "<p />"
End Try
End Sub
</script>	
<html>
<head>
<title>ADO.NET </title>
</head>
<body >   
Number of SubCategory is <%=liCount%>           
<div id="outError" runat="server" />
<br />
</body>
</html>
